package com.example.springbootlearn.utils;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author caiji Mr. Li
 * @date 2019/11/25 14:01
 */
@RestController
public class IPController {

    @Autowired
    private IpInfoUtil ipInfoUtil;


    @GetMapping("/iptest")
    public String ipTest(HttpServletRequest request) {
        String ipAddr = ipInfoUtil.getIpAddr(request);
        System.out.println(ipAddr);
        return "success";
    }
}
